/*
 * BaseRefreshListAdapter.java
 * classes : com.ruint.core.adapter.BaseRefreshListAdapter
 * @author ruint
 * V 1.0.0
 * Create at 2014-12-2 下午3:33:40
 */
package com.ruint.core.adapter;

import java.util.List;

import android.content.Context;
import android.widget.AbsListView;

import com.ruint.core.utils.DateUtils;
import com.ruint.lib.pulltorefresh.library.PullToRefreshAdapterViewBase;

/**
 * com.ruint.core.adapter.BaseRefreshListAdapter
 * 
 * @author ruint <br/>
 *         create at 2014-12-2 下午3:33:40
 * @param <T>
 */
public abstract class BaseRefreshListAdapter<T, V extends PullToRefreshAdapterViewBase<? extends AbsListView>> extends
    BaseListAdapter<T> {

  protected V v;

  public BaseRefreshListAdapter(Context context, V v) {
    super(context);
    this.v = v;
  }

  @Override
  public void refresh(List<T> data) {
    clear();
    build(data);
    notifyDataSetChanged();
    v.onRefreshComplete(DateUtils.toDateAndTime(System.currentTimeMillis()));
  }
}
